Repository navigation
Conversation
The runner only wrote dedupe keys and cursors; the alerts and sends tables were never populated, so there was nothing to export or audit. Each alert that passes predicates, rate limit and dedupe is now stored before any sink is called, with a JSON payload and an event fingerprint, and every sink attempt is recorded as sent or failed. Sending behaviour is unchanged and dry-run still writes nothing. Adds ListCursors and ListAlerts (with per-sink sends and rule/since/limit filters) to the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both commands were stubs that printed TODO although the README documents them. - state: per-source cursor height, chain head, lag, confirmations, hash and last update; flags --format table|json, --offline, --db. Flags sources not started yet and cursors no longer in the config; an unreachable RPC is reported on its row. - export alerts|cursors: --format json|csv, -o file, and for alerts --rule, --since (duration or RFC3339) and --limit, including each alert's per-sink delivery status. --db reads the ledger without loading the config, and both commands refuse a missing database instead of creating an empty one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The README documents
watch-tower stateandwatch-tower export, but both were stubs that printedTODO. Makingexport alertsuseful also exposed a bigger gap: the runner never wrote to thealertsorsendstables (only dedupe keys and cursors), so there was nothing to export or audit.What changed
feat(engine): record alerts and sink deliveries in the ledgerrule_id,chain,source_id,height,hash,txhash,log_index,app_id,args) and an event fingerprint (rule|source|txhash|logIndex|appID).sentorfailed. A failing sink still aborts the pass as before, but now leaves a record.args_error) instead of stopping alerting.--dry-runstill writes nothing.ListCursorsandListAlerts(per-sink sends,rule/since/limitfilters).feat(cli): implement state and export commandsstate: per source, cursor height, chain head, lag, confirmations, hash and last update.--format table|json;--offlineskips RPC calls;--dbreads the ledger without loading the config.export alerts|cursors:--format json|csv,-o file; for alerts--rule,--since(duration like24hor RFC3339) and--limit N, including each alert's per-sink status.Reviewer notes
dedupe, resends the alert and records it again (same fingerprint, new id). Alert ids are random, so the ledger does not enforce exactly-once by event.--sincefiltering of alerts happen in Go: rows written withCURRENT_TIMESTAMPand with bound time values use different text layouts in SQLite.response_codeinsendsstays 0: theSenderinterface only returns an error.Testing
internal/storage/store_list_test.go,internal/engine/runner_ledger_test.go,cmd/watch-tower/state_export_test.go(commands run end to end through the root command against a seeded DB; head lookups use a fake).go vet ./...andgo test ./...pass; smoke-tested the built binary's help and missing-DB error.🤖 Generated with Claude Code